<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>ArraySort Tests</title>
<script type="text/javascript" src="../../../build/yui/yui-debug.js"></script>
</head>

<body class="yui3-skin-sam">
<h1>ArraySort Tests</h1>
<p><input type="button" value="Run Tests" id="btnRun" disabled=true></p>

<script type="text/javascript">
(function() {
    YUI({
        filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
        allowRollup: false
    }).use("console", "test", "dump", "arraysort", function(Y) {
        
        // Set up the page
        var ASSERT = Y.Assert,
            ARRAYASSERT = Y.ArrayAssert,
            BTNRUN = Y.one("#btnRun");
        BTNRUN.set("disabled", false);
        Y.on("click", function(e){
            Y.Test.Runner.run();
        }, BTNRUN);
        var myConsole = new Y.Console().render();
        

        var testBasic = new Y.Test.Case({
            name: "Basic Tests",
        
            testNumbers: function() {
                var array = [2,1,3,5,4];
                array.sort(Y.ArraySort.compare)
                ARRAYASSERT.itemsAreSame([1,2,3,4,5], array, "Expected sorted numbers.");
            },

            testStrings: function() {
                var array = ["caa", "baa", "bba", "aba", "cba", "aaa", "abc"];
                array.sort(Y.ArraySort.compare)
                ARRAYASSERT.itemsAreSame(["aaa","aba","abc","baa","bba","caa","cba"], array, "Expected sorted strings.");
            },
            
            testMixedStrings: function() {
                var array = ["attic", "Aardvark", "1", "0", "Zoo", "zebra"];
                array.sort(Y.ArraySort.compare)
                ARRAYASSERT.itemsAreSame(["0", "1", "Aardvark","attic","zebra","Zoo"], array, "Expected sorted mixed strings.");
            }
        });

        var suite = new Y.Test.Suite({name:"ArraySort Test Suite"});
        suite.add(testBasic);

        Y.Test.Runner.setName("ArraySort Test Runner");
        Y.Test.Runner.add(suite);
        Y.Test.Runner.run();
    });
})();
</script>
</body>
</html>
